
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<jsp:directive.page import="java.sql.*" />
<jsp:directive.page import="Connectivity.ConnectionManager" />
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String Activity = request.getParameter("Activity") != null ? request
			.getParameter("Activity")
			: "2";
	//employee_id=3027%24SANDEEP&fdate=2-5-2012&tdate=2-5-2012
	String fdate = request.getParameter("fdate") != null ? request
			.getParameter("fdate") : "";
	String tdate = request.getParameter("tdate") != null ? request
			.getParameter("tdate") : "";
	Connection con = ConnectionManager.getConnection();
	int emp_eid = 0;
	String emp_name = "";
	StringTokenizer st = new StringTokenizer((request
			.getParameter("employee_id")), "$");
	emp_eid = Integer.parseInt("" + st.nextToken());
	emp_name = st.nextToken();

	String year = "" + (fdate.split("-", 2));
	String month = "" + (fdate.split("-", 1));
	String date = "" + (fdate.split("-", 0));
	//fdate = year + "-" + month + "-" + date;

	String yeart = "" + (tdate.split("-", 2));
	String montht = "" + (tdate.split("-", 1));
	String datet = "" + (tdate.split("-", 0));
	//tdate = yeart + "-" + montht + "-" + datet;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>


		<title>EMPLOYEE EXPENSE</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<script type="text/javascript" src="/other/data.js"></script>

		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>


	<body>

		<table border=1 bordercolor=black width=100% height=100% cellspacing=0>
			<tr>
				<td>
					<table align=right border=1 bordercolor=black height=50% width=100%
						cellspacing=0>
						<tr width=100%>
							<td align=center colspan=10>
								<font size=5><b><%=(session.getAttribute("firm_name"))%>
								</b>
								</font>
							</td>
							<td align=right colspan=1>
								<img src="<%=basePath%>images\Company.jpg" height=119 width=109>
							</td>
						</tr>

						<form name=callassign action=temp.jsp method=get>
							<%
								String role_id1 = "" + (session.getAttribute("role_id"));
								if (role_id1.equals("1") && emp_eid != 0) {
							%>
						
						<tr>
							<td>


							</td>
						</tr>



						<%
							}
							String space = "&nbsp;&nbsp;&nbsp;&nbsp;";
						%>
						<tr>
							<td align=center colspan=11>
								<font size=4 color=Blue> EMPLOYEE EXPENSE REPORT<%=emp_eid%>
								</font>
							</td>
						</tr>
						<tr>
							<td colspan=1 rowspan=2 align=top>
								<font size=4 color="light pink"><b>Sr.No.</b>
								</font>
							</td>
							<td colspan=1 rowspan=2 nowrap="nowrap">
								<font size=2 color="light pink"><b>CLOSED DATE </b>
								</font>
							</td>
							<td colspan=1 rowspan=2 nowrap="nowrap">
								<font size=2 color="light pink"><b>COMPLAINT ID </b>
								</font>
							</td>
							<td colspan=1 rowspan=2 nowrap="nowrap">
								<font size=2 color="light pink"><b>EMPLOYEE NAME</b>
								</font>
							</td>
							<td colspan=2 rowspan=2>
								<font size=2 color="light pink"><b>CUSTOMER NAME <%=space%>
								</b>
								</font>
							</td>

							<td colspan=1 rowspan=2>
								<font size=2 color="light pink"><b>TRAVELLING </b>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="light pink"><b>FOOD EXPENSE</b>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="light pink"><b>LODGE</b>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="light pink"><b>OTHER</b>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="light pink"><b>TOTAL</b>
								</font>
							</td>
						</tr>

						<%
							boolean flag = false;
							int count = 0;
							String call_details = "", item = "", call_status = "";
							String compalint_id = "-", customer_name = "-", area = "-", cust_type = "-", callentry_id = "", assigndate = "", employee_name = "";
							try {
								CallableStatement cstmt = null;
								ResultSet calldisplayrs = null;
								
								cstmt = con
								.prepareCall("{?=call fun_retrieve_emp_expense_report(?,?,?,?)}");
								cstmt.registerOutParameter(1, Types.OTHER);
								cstmt.setString(2, "" + emp_eid);
								cstmt.setString(3, fdate);
								cstmt.setString(4, tdate);
								cstmt.setObject(5, calldisplayrs);

								con.setAutoCommit(false);
								cstmt.execute();

								calldisplayrs = (ResultSet) cstmt.getObject(1);

								float ta = 0, fe = 0, other = 0, lodge = 0, total = 0;
								float totalta = 0, totalfe = 0, totalother = 0, totallodge = 0, totaloftotal = 0;
								String call_performed = "";
								String employ_id = "";
								//String calldisplay="select function fun_retrieve_callentry("+calltypestaus+")";
								// PreparedStatement calldisplayprs=con.prepareStatement(calldisplay);
								//ResultSet calldisplayrs=calldisplayprs.executeQuery();
								while (calldisplayrs.next()) {
									flag = true;
									count++;
									assigndate = calldisplayrs.getString(1);
									compalint_id = calldisplayrs.getString(2);
									customer_name = calldisplayrs.getString(3);
									employee_name = calldisplayrs.getString(4);
									ta = Float.parseFloat("" + calldisplayrs.getString(5));
									fe = Float.parseFloat("" + calldisplayrs.getString(6));
									lodge = Float.parseFloat("" + calldisplayrs.getString(7));
									other = Float.parseFloat("" + calldisplayrs.getString(8));
									total = Float.parseFloat("" + calldisplayrs.getString(9));
									call_performed = calldisplayrs.getString(10);
									employ_id = calldisplayrs.getString(11);
									totalta = totalta + ta;
									totalfe = totalfe + fe;
									totallodge = totallodge + lodge;
									totalother = totalother + other;
									totaloftotal = totaloftotal + total;
						%>
						<tr></tr>
						<tr>

							<td colspan=1 rowspan=2>
								<font size=2><%=count%>
								</font>
							</td>
							<td colspan=1 rowspan=2 nowrap="nowrap">
								<font size=2 color="BLACK"><%=assigndate%>
								</font>
							</td>
							<td colspan=1 rowspan=2 nowrap="nowrap">
								<font size=2 color="BLACK"><%=compalint_id%>
								</font>
							</td>
							<td colspan=2 rowspan=2 nowrap="nowrap">
								<font size=2 color="BLACK"><%=customer_name.toUpperCase()%>
								</font>
							</td>
							<td colspan=1 rowspan=2 nowrap="nowrap">
								<font size=2 color="BLACK"><%=employee_name.toUpperCase()%>
								</font>
							</td>
							<td colspan=1 rowspan=2 width=20%>
								<font size=2 color="BLACK"><%=ta%>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="BLACK"><%=fe%>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="BLACK"><%=lodge%>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="BLACK"><%=other%>
								</font>
							</td>
							<td colspan=1 rowspan=2>
								<font size=2 color="BLACK"><%=total%>
								</font>
							</td>
						</tr>



						<%
						}
						%>
						<tr>
							<br>
						</tr>
						<tr>
							<td colspan=10 align=right>
								<font size=3 color="BLACK"><b>TOTAL </b>
								</font>
							</td>
							<td colspan=1 align=center>
								<b> <%=totaloftotal%>
								</b>
							</td>
						</tr>
						<!--  <a href="paging.jsp">paging</a>
    -->
						</form>

						<%
								} catch (Exception e) {
								e.printStackTrace();
							} finally {
								con.close();
							}
						%>
					
	</body>
</html>
